/*
 * Copyright 2010 Biz-e (info@biz-e.nl)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.biz_e.gdata.domain;

import nl.biz_e.gdata.data.AbstractBaseManager;
import nl.biz_e.gdata.util.GDataAuthentication;
import nl.biz_e.gdata.util.Utils;

import com.google.gdata.client.contacts.ContactsService;
import com.google.gdata.data.contacts.ProfileEntry;
import com.google.gdata.data.contacts.ProfileFeed;
import com.google.gdata.util.AuthenticationException;

/**
 * TODO: Write type comment
 * 
 * @author Joost A. Bloemsma
 */
public class UsersManager extends
        AbstractBaseManager<ProfileEntry, ProfileFeed> {
    private static final String FEEDNAME = "profiles";
    private final ContactsService service;

    /**
     * Constructs a new UsersManager instance.<br/>
     * The application name must have been set to the static
     * {@link Utils#APPNAME} variable.
     * 
     * @param authentication
     *            Used for authentication agains the GData Service
     * @throws AuthenticationException
     *             If authentication fails
     */
    public UsersManager(GDataAuthentication authentication)
            throws AuthenticationException {
        this(authentication, Utils.APPNAME);
    }

    /**
     * Constructs a new UsersManager instance
     * 
     * @param authentication
     *            Used for authentication agains the GData Service
     * @param appName
     *            The application name
     * @throws AuthenticationException
     *             If authentication fails
     */
    public UsersManager(GDataAuthentication authentication, String appName)
            throws AuthenticationException {
        super(authentication, FEEDNAME, ProfileFeed.class, ProfileEntry.class,
                appName);
        this.service = new ContactsService(this.getAppName());
        this.setService(service);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected String getUrlExtension() {
        return "full/";
    }

}
